<template>

  <div style="margin-top:40px;width:80%;">
    <kv label="原密码">
      <el-input v-model="$data.oldPassword" chk="{value.length}[4]"/>
    </kv>
    <kv label="一次性mfa">
      <div>
        <el-input v-model="$data.mfa1"
                  chk="?: if( value.length<4 ) return '长度为空表示清除! 或者不能小于4'; "/>
        <div>长度必须大于4位，必须包含数字和字母</div>
      </div>
    </kv>
    <kv label="到期时间">
      <div>
        <div>{{ $data.mfa1ExpireAt }}</div>
        <el-date-picker-panel v-model="$data.mfa1ExpireAt" value-format="YYYY-MM-DD"/>
      </div>
    </kv>
    <div style="display: flex;justify-content: center; margin-top:40px;">
      <el-button type="primary" @click="changePwd();">确定</el-button>
    </div>
  </div>


</template>
<style scoped lang="scss">
:deep(.kv) {
  align-items: flex-start;
  margin: 20px;

  .k {
    flex: 4 !important;
    min-width: auto !important;
  }

}

</style>
<script setup>
/**
 * Created by CodeGenerator
 */


//定义data
const $data = reactive({
  oldPassword: "",
  mfa1: "",
  mfa1ExpireAt: ""
});

//定义事件
const $emit = defineEmits(["update:modelValue", "loaded"]);

const card = ref();

const changePwd = function () {
  if (jv.chk_main({$data: $data}) == false) {
    return;
  }
  jv.$http.post("/sys/reset-mfa1", $data).then(res => {
    jv.info("设置成功");
  })
};

onMounted(function () {
})


</script>
